package com.bsoft.ecommerce.constant;

import lombok.AllArgsConstructor;
import lombok.Getter;
import org.apache.kafka.common.protocol.types.Field;

import javax.xml.soap.SAAJResult;
import java.util.Objects;
import java.util.stream.Stream;

@Getter
@AllArgsConstructor
public enum BrandCategory {
     BRAND_A("20001","品牌A"),
      BRAND_B("20002","品牌B"),
      BRAND_C("20003","品牌C"),
    BRAND_D("20004","品牌D"),
    BRAND_E("20005","品牌E"),

;

    private final String code;

    private final String description;

    public static  BrandCategory of(String code){
        Objects.requireNonNull(code);
        return Stream.of(values())
                .filter(bean->bean.equals(code))
                 .findAny()
                .orElseThrow(()->
                         new IllegalArgumentException(code+"not exists")
                        );
    }
}
